set(CMAKE_VERSION_MAJOR 26)
set(CMAKE_VERSION_MINOR 1)
set(CMAKE_VERSION_PATCH 0)

set(CMAKE_PROJECTED_RELEASE_DATE "31 March 2026")

set(PREV_RELEASE_MAJOR 25)
set(PREV_RELEASE_MINOR 2)
set(PREV_RELEASE_PATCH 0)
set(PREV_RELEASE_SHA "cf73682")

set(ENERGYPLUS_VERSION "${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}.${CMAKE_VERSION_PATCH}")

string(TIMESTAMP CMAKE_YEAR "%Y")

set(CMAKE_VERSION_BUILD "Unknown" CACHE STRING "Build number")
find_package(Git)

if(NOT GIT_FOUND)
  find_program(GIT_EXECUTABLE git HINTS "$ENV{LOCALAPPDATA}/Programs/git/bin")
  if(NOT GIT_EXECUTABLE_NOTFOUND)
    set(GIT_FOUND TRUE)
  endif()
endif()

if(GIT_FOUND)
  execute_process(
    COMMAND "${GIT_EXECUTABLE}" "rev-parse" "--short=10" "HEAD"
    WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
    TIMEOUT 10
    RESULT_VARIABLE RESULT
    OUTPUT_VARIABLE GIT_VERSION
    ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
  if(${RESULT} EQUAL 0 AND NOT "${GIT_VERSION}" EQUAL "${CMAKE_VERSION_BUILD}")
    set(CMAKE_VERSION_BUILD ${GIT_VERSION} CACHE STRING "Build number" FORCE) # git sha
  endif()

  get_filename_component(GIT_DIR "${GIT_EXECUTABLE}" PATH)
else()
  set(GIT_DIR "")
endif()
